package sorting;
import java.util.Arrays;

import util.ArrayUtil;
public class SelectionSort {

	public static void sort(float[] numbers)
	{
		for(int sorted = 0; sorted < numbers.length - 1; sorted ++)
		{
			int smallist = sorted;

			for(int j = sorted + 1; j < numbers.length; j ++)
			{
				if(numbers[smallist] > numbers[j])
				{
					smallist = j;
				}
			}
			
			ArrayUtil.each(numbers, sorted, smallist);
		}
	}
	
	public static void main(String[] args) {
		float[] numbers = {5,9,7,1,3,2,6,8,4};
		sort(numbers);
		System.out.println(Arrays.toString(numbers));
	}
}
